package com.server.entity;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;



/**
 * The persistent class for the ItemComment database table.
 * 
 */
@Entity
@XmlRootElement
@Table(schema="mhp")
@NamedQuery(name="GetCommentByItem",query="select e from ItemComment e where e.itemId=:ItemId")
public class ItemComment implements Serializable {
	private static final long serialVersionUID = 1L;
		

	
	public ItemComment() {
	}
	
	
	public ItemComment(String userId, String comment, int commentType,
			Item item, User user) {
		super();
		this.uId = userId;
		this.comment = comment;
		this.commentType = commentType;
		this.item = item;
		this.user = user;
	}

	@Id
	@Column(name="USERID")
	private String uId;

	private String comment;

	private int commentType;
	
	private String itemId;
		
	
	@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE})
	@JoinColumn(name="itemId",insertable=false, updatable=false)
	private Item item;
	
	@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE})
	@JoinColumn(name="userId",insertable=false, updatable=false)
	private User user;

	
	public String getItemId() {
		return itemId;
	}


	public void setItemId(String itemId) {
		this.itemId = itemId;
	}


	public Item getItem() {
		return item;
	}

	public void setItem(Item item) {
		this.item = item;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}


	public String getComment() {
		return this.comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public int getCommentType() {
		return this.commentType;
	}

	public void setCommentType(int commentType) {
		this.commentType = commentType;
	}


	public String getUserId() {
		return this.uId;
	}

	public void setUserId(String userId) {
		this.uId = userId;
	}

}